package com.intel.utils
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.text.TextField;
	
	/**
	 * ...
	 * @author ...
	 * @desc 	Debugger to trace out info
	 */
	public class Debugger 
	{
		public static const ERROR:int = 0;
		public static const WARNING:int = 1;
		public static const DEV:int = 2;
		public static const INFORMATION:int = 3;
		
		private static var iReportLevel:int = 0;
		
		public static var txtDebug:TextField;
		
		//public function Debugger() {		}
		
		public static function traceOut(in_msg:String, iLevel:int = Debugger.DEV):void 
		{
			if (iLevel <= Debugger.iReportLevel) {
				trace(Debugger.getLevel(iLevel) + " :: " + in_msg);
				trace("\n");				
				if (txtDebug != null) {
					txtDebug.appendText(Debugger.getLevel(iLevel) + " :: " + in_msg + "\n");
				}
			}
		}
		
		private static function getLevel(iLevel:int):String 
		{
			
			if (iLevel == 0) {
				return "ERROR";
			} else if (iLevel == 1) {
				return "WARNING";
			} else if (iLevel == 2) {
				return "DEV";
			} else  {
				return "INFORMATION";
			}			
		}
		
		public static function setRoot(root:Sprite):void 
		{
			trace("in_mc " + root);
			
			txtDebug = root.getChildByName("txtDebug") as TextField;
			
			trace("txtDebug " + txtDebug);
		}
		
	}
	
}